// example sample data and code
(function(){
    // some sample data
    // global var "data"
    data = [["t","w","x","q"]];
    try{
    var call = new WS.Call("http://localhost:8080/logistics-ws/services/BasicManageService");
    var nsuri = 'http://localhost:8080/';
    var qn_op = new WS.QName('getAllPlacevo', nsuri);
    var qn_op_resp = new WS.QName('getAllPlacevoResponse', nsuri);
    call.invoke_rpc(qn_op, new Array(), null, function(call, envelope){
        var ret = envelope.get_body().get_all_children()[0].get_all_children()[0];
        var placeVOs = ret.get_all_children();
        alert(placeVOs.length);
        
        for (var j = 0; j < placeVOs.length; j++) {
            var placeVO = placeVOs[j].get_all_children();
			alert(placeVO[0].get_value());
            try {
                var items = new Array();
                items[0] = placeVO[0].get_value();
                items[1] = placeVO[2].get_value();
                items[2] = placeVO[3].get_value();
                items[3] = placeVO[4].get_value();
                data[data.length]=items;
            } 
            catch (x) {
                alert("error!"+x);
            }
            
        }
        
        
    });
    }catch(y){
		
		for(i in y){
			alert(y[i]);
		}
	}
    //    var rows = 100;
    //    for (var i = 0, l = data.length; i < rows - l; i++) {
    //        data.push(data[i % l].slice(0));
    //    }
    
    // global var "model"
    model = new dojox.grid.data.Table(null, data);
    
    // simple display of row info; based on model observation
    // global var "modelChange"
    modelChange = function(){
        var n = dojo.byId('rowCount');
        if (n) {
            n.innerHTML = Number(model.getRowCount()) + ' row(s)';
        }
    }
})();
